package com.itheima.reggie.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.itheima.reggie.common.LocalDateTimeConverter;
import com.itheima.reggie.common.SexConverter;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;
    @ExcelProperty(value ="用户id" )
    @NumberFormat
    private Long id;
    @ExcelProperty(value = "账号")
    private String username;
    @ExcelProperty(value = "用户名")
    private String name;
    @ExcelIgnore
    private String password;
    @ExcelProperty(value = "手机号")
    private String phone;
    @ExcelProperty(value = "性别",converter = SexConverter.class)
    private String sex;
    @ExcelProperty(value = "身份证号")
    private String idNumber; //驼峰命名法 ---> 映射的字段名为 id_number
    @ExcelProperty(value = "状态")
    private Integer status;

    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT)
    @ExcelProperty(value = "创建时间",converter = LocalDateTimeConverter.class)
    private LocalDateTime createTime;

    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ExcelProperty(value = "修改时间",converter = LocalDateTimeConverter.class)
    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT)
    @ExcelProperty(value = "创建人id")
    private Long createUser;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ExcelProperty(value = "修改人id")
    private Long updateUser;
}